﻿namespace KeRui.BLL
{
    using KeRui.Common;
    using KeRui.DAL;
    using System;
    using System.Data;

    public class CmsContentForModelid
    {
        private readonly KeRui.DAL.Common dal = new KeRui.DAL.Common();

        public DataTable _Class_GetList(string tblName, int PageSize, int PageIndex, string strKey)
        {
            string strWhere = " 1=1 AND Keyword LIKE '%" + strKey + "%'";
            string strOrder = " ContentID DESC";
            return this.dal.GetList(tblName, PageSize, PageIndex, strWhere, strOrder).Tables[0];
        }

        public DataTable _Class_GetListBySellerID(string tblName, int PageSize, int PageIndex, string WhereCondition)
        {
            string strWhere = " 1=1 ";
            if (WhereCondition != "")
            {
                strWhere = strWhere + WhereCondition;
            }
            string strOrder = " ContentID DESC";
            return this.dal.GetList(tblName, PageSize, PageIndex, strWhere, strOrder).Tables[0];
        }

        public void deleteoldtag()
        {
            KeRui.BLL.Common.ExecuteSQL("DELETE SearchData WHERE DATEdiff(dd,UpdateTime,GETDATE())>30");
        }

        public int GetClassCountByWhere(string tblName, string strKey)
        {
            string strWhere = " 1=1";
            if (strKey != "")
            {
                strWhere = strWhere + " AND Keyword LIKE '%" + strKey + "%'";
            }
            KeRui.DAL.Common common = new KeRui.DAL.Common();
            return common.GetCount(tblName, strWhere);
        }

        public int GetCount(string tblName, string Title, string CarProvince, string CarCity, string CarArea, string PriceMax, string PriceSmall, string StartTime, string EndTime, int UserNum)
        {
            string strWhere = " UserNum= " + UserNum;
            if (Title != "")
            {
                strWhere = strWhere + " and Title like '%" + Title + "%'";
            }
            if (CarArea != "")
            {
                strWhere = strWhere + " and CarArea = '" + CarArea + "'";
            }
            else if (CarCity != "")
            {
                strWhere = strWhere + " and CarCity = '" + CarCity + "'";
            }
            else if (CarProvince != "")
            {
                strWhere = strWhere + " and CarProvince = '" + CarProvince + "'";
            }
            if (PriceMax != "")
            {
                strWhere = strWhere + " and Price <= " + PriceMax;
            }
            if (PriceSmall != "")
            {
                strWhere = strWhere + " and Price >= " + PriceSmall;
            }
            if ((StartTime != "") & Utils.IsDateTime(StartTime))
            {
                strWhere = strWhere + " and CreateDate >='" + Utils.SqlStringFormat(StartTime) + "'";
            }
            if ((EndTime != "") & Utils.IsDateTime(EndTime))
            {
                strWhere = strWhere + " and CreateDate <='" + Utils.SqlStringFormat(EndTime) + "'";
            }
            KeRui.DAL.Common common = new KeRui.DAL.Common();
            return common.GetCount(tblName, strWhere);
        }

        public int GetCountByWhere(string tblName, string strWhere)
        {
            KeRui.DAL.Common common = new KeRui.DAL.Common();
            return common.GetCount(tblName, strWhere);
        }

        public int GetCountCar(string tblName, string Title, string Brand, string CarLevel, string CarType, string PriceMax, string PriceSmall, string VentMete)
        {
            string strWhere = " 1=1 ";
            if (Title != "")
            {
                strWhere = strWhere + " and Title like '%" + Title + "%'";
            }
            if (Brand != "")
            {
                strWhere = strWhere + " and Brand like '%" + Brand + "%'";
            }
            else if (CarLevel != "")
            {
                strWhere = strWhere + " and CarLevel like '%" + CarLevel + "%'";
            }
            else if (CarType != "")
            {
                strWhere = strWhere + " and CarType like '%" + CarType + "%'";
            }
            if ((PriceMax != "") & Utils.IsNumber(PriceMax))
            {
                strWhere = strWhere + " and ManufacturerPrice <= " + PriceMax;
            }
            if ((PriceSmall != "") & Utils.IsNumber(PriceSmall))
            {
                strWhere = strWhere + " and ManufacturerPrice >= " + PriceSmall;
            }
            if (VentMete != "")
            {
                strWhere = strWhere + " and VentMete like '%" + VentMete + "%'";
            }
            KeRui.DAL.Common common = new KeRui.DAL.Common();
            return common.GetCount(tblName, strWhere);
        }

        public int GetCountHouse(string tblName, string Title, string HouseProvince, string HouseCity, string HouseArea, string PriceMax, string PriceSmall, string StartTime, string EndTime)
        {
            string strWhere = " 1=1 ";
            if (Title != "")
            {
                strWhere = strWhere + " and Title like '%" + Title + "%'";
            }
            if (HouseArea != "")
            {
                strWhere = strWhere + " and HouseArea = '" + HouseArea + "'";
            }
            else if (HouseCity != "")
            {
                strWhere = strWhere + " and HouseCity = '" + HouseCity + "'";
            }
            else if (HouseProvince != "")
            {
                strWhere = strWhere + " and HouseProvince = '" + HouseProvince + "'";
            }
            if ((PriceMax != "") & Utils.IsNumber(PriceMax))
            {
                strWhere = strWhere + " and HouseHirePrice <= " + PriceMax;
            }
            if ((PriceSmall != "") & Utils.IsNumber(PriceSmall))
            {
                strWhere = strWhere + " and HouseHirePrice >= " + PriceSmall;
            }
            if ((StartTime != "") & Utils.IsDateTime(StartTime))
            {
                strWhere = strWhere + " and CreateDate >='" + Utils.SqlStringFormat(StartTime) + "'";
            }
            if ((EndTime != "") & Utils.IsDateTime(EndTime))
            {
                strWhere = strWhere + " and CreateDate <='" + Utils.SqlStringFormat(EndTime) + "'";
            }
            KeRui.DAL.Common common = new KeRui.DAL.Common();
            return common.GetCount(tblName, strWhere);
        }

        public int GetCountSell(string tblName, string Title, string CarProvince, string CarCity, string CarArea, string PriceMax, string PriceSmall, string StartTime, string EndTime, int UserNum)
        {
            string strWhere = " UserNum= " + UserNum;
            if (Title != "")
            {
                strWhere = strWhere + " and Title like '%" + Title + "%'";
            }
            if (CarArea != "")
            {
                strWhere = strWhere + " and CarArea = '" + CarArea + "'";
            }
            else if (CarCity != "")
            {
                strWhere = strWhere + " and CarCity = '" + CarCity + "'";
            }
            else if (CarProvince != "")
            {
                strWhere = strWhere + " and CarProvince = '" + CarProvince + "'";
            }
            if (PriceMax != "")
            {
                strWhere = strWhere + " and Price <= " + PriceMax;
            }
            if (PriceSmall != "")
            {
                strWhere = strWhere + " and Price >= " + PriceSmall;
            }
            if ((StartTime != "") & Utils.IsDateTime(StartTime))
            {
                strWhere = strWhere + " and CreateDate >='" + Utils.SqlStringFormat(StartTime) + "'";
            }
            if ((EndTime != "") & Utils.IsDateTime(EndTime))
            {
                strWhere = strWhere + " and CreateDate <='" + Utils.SqlStringFormat(EndTime) + "'";
            }
            KeRui.DAL.Common common = new KeRui.DAL.Common();
            return common.GetCount(tblName, strWhere);
        }

        public DataSet GetDataTableBySql(string strFld, string strOrder, string tblName, string strWhere)
        {
            return this.dal.GetDataTableBySql("SELECT  " + strFld + " FROM " + tblName + " WHERE " + strWhere + " ORDER BY " + strOrder);
        }

        public int GetJobCountByUID(string tblName, int userID)
        {
            string strWhere = " 1=1";
            if (userID != -1)
            {
                strWhere = strWhere + " AND UserID =" + userID;
            }
            KeRui.DAL.Common common = new KeRui.DAL.Common();
            return common.GetCount(tblName, strWhere);
        }

        public int GetJobCountByWhere(string tblName, int sellerID)
        {
            string strWhere = " 1=1";
            if (sellerID != -1)
            {
                strWhere = strWhere + " AND SellerID =" + sellerID;
            }
            KeRui.DAL.Common common = new KeRui.DAL.Common();
            return common.GetCount(tblName, strWhere);
        }

        public int GetJobCountByWhere(string tblName, string WhereCondition)
        {
            string strWhere = " 1=1";
            if (WhereCondition != "")
            {
                strWhere = strWhere + WhereCondition;
            }
            KeRui.DAL.Common common = new KeRui.DAL.Common();
            return common.GetCount(tblName, strWhere);
        }

        public int GetJobCountByWhere(string tblName, int sellerID, string address)
        {
            string strWhere = " 1=1";
            if (sellerID != -1)
            {
                strWhere = strWhere + " AND SellerID =" + sellerID;
            }
            if ((address != "") || (address != "工作地点"))
            {
                strWhere = strWhere + " AND Address='" + address + "'";
            }
            KeRui.DAL.Common common = new KeRui.DAL.Common();
            return common.GetCount(tblName, strWhere);
        }

        public int GetJobCountByWhere(string tblName, string strCompName, string strJobName, string strSite, string strDegree, string strWorkYear, string strWorkType, string strSalary, string dtIssue)
        {
            string strWhere = " 1=1";
            if (strCompName != "")
            {
                strWhere = strWhere + " AND SellerName like '%" + strCompName + "%'";
            }
            if (strJobName != "")
            {
                strWhere = strWhere + " AND Name like '%" + strJobName + "%'";
            }
            if (strSite != "")
            {
                strWhere = strWhere + " AND Address like '%" + strSite + "%'";
            }
            if (strDegree != "")
            {
                strWhere = strWhere + " AND Degree like '%" + strDegree + "%'";
            }
            if (strWorkYear != "")
            {
                strWhere = strWhere + " AND WorkYear like '%" + strWorkYear + "%'";
            }
            if (strWorkType != "")
            {
                strWhere = strWhere + " AND WorkType like '%" + strWorkType + "%'";
            }
            if (strSalary != "")
            {
                strWhere = strWhere + " AND Salary like '%" + strSalary + "%'";
            }
            if (dtIssue != "")
            {
                strWhere = strWhere + " AND IssuseDate >= '" + dtIssue + "'";
            }
            KeRui.DAL.Common common = new KeRui.DAL.Common();
            return common.GetCount(tblName, strWhere);
        }

        public DataTable GetJobInfoByID(string tblName, int PageSize, int PageIndex, int ContentID)
        {
            string strWhere = " ContentID = " + ContentID;
            string strOrder = " ContentID DESC";
            return this.dal.GetList(tblName, PageSize, PageIndex, strWhere, strOrder).Tables[0];
        }

        public DataTable GetList(string tblName, string fldName, int PageSize, int PageIndex, string Title, string CarProvince, string CarCity, string CarArea, string PriceMax, string PriceSmall, string StartTime, string EndTime, int UserNum)
        {
            string strWhere = " UserNum= " + UserNum;
            if (Title != "")
            {
                strWhere = strWhere + " and Title like '%" + Title + "%'";
            }
            if (CarArea != "")
            {
                strWhere = strWhere + " and CarArea = '" + CarArea + "'";
            }
            else if (CarCity != "")
            {
                strWhere = strWhere + " and CarCity = '" + CarCity + "'";
            }
            else if (CarProvince != "")
            {
                strWhere = strWhere + " and CarProvince = '" + CarProvince + "'";
            }
            if ((PriceMax != "") & Utils.IsNumber(PriceMax))
            {
                strWhere = strWhere + " and Price <= " + PriceMax;
            }
            if ((PriceSmall != "") & Utils.IsNumber(PriceSmall))
            {
                strWhere = strWhere + " and Price >= " + PriceSmall;
            }
            if ((StartTime != "") & Utils.IsDateTime(StartTime))
            {
                strWhere = strWhere + " and CreateDate >='" + Utils.SqlStringFormat(StartTime) + "'";
            }
            if ((EndTime != "") & Utils.IsDateTime(EndTime))
            {
                strWhere = strWhere + " and CreateDate <='" + Utils.SqlStringFormat(EndTime) + "'";
            }
            string strOrder = " IsOnTop desc,CreateDate desc";
            return this.dal.GetList(tblName, PageSize, PageIndex, strWhere, strOrder, fldName).Tables[0];
        }

        public DataTable GetListByWhere(string tblName, int PageSize, int PageIndex, string strWhere, string strOrder)
        {
            return this.dal.GetList(tblName, PageSize, PageIndex, strWhere, strOrder).Tables[0];
        }

        public DataSet GetListByWhere(string tblName, string strWhere, int PageSize, int PageIndex, string strOrder)
        {
            return this.dal.GetList(tblName, PageSize, PageIndex, strWhere, strOrder, "*");
        }

        public DataSet GetListByWhere(string tblName, string strWhere, int PageSize, int PageIndex, string strOrder, string strfld)
        {
            return this.dal.GetList(tblName, PageSize, PageIndex, strWhere, strOrder, strfld);
        }

        public DataTable GetListCar(string tblName, string fldName, int PageSize, int PageIndex, string Title, string Brand, string CarLevel, string CarType, string PriceMax, string PriceSmall, string VentMete)
        {
            string strWhere = " 1=1 ";
            if (Title != "")
            {
                strWhere = strWhere + " and Title like '%" + Title + "%'";
            }
            if (Brand != "")
            {
                strWhere = strWhere + " and Brand like '%" + Brand + "%'";
            }
            else if (CarLevel != "")
            {
                strWhere = strWhere + " and CarLevel like '%" + CarLevel + "%'";
            }
            else if (CarType != "")
            {
                strWhere = strWhere + " and CarType like '%" + CarType + "%'";
            }
            if ((PriceMax != "") & Utils.IsNumber(PriceMax))
            {
                strWhere = strWhere + " and ManufacturerPrice <= " + PriceMax;
            }
            if ((PriceSmall != "") & Utils.IsNumber(PriceSmall))
            {
                strWhere = strWhere + " and ManufacturerPrice >= " + PriceSmall;
            }
            if (VentMete != "")
            {
                strWhere = strWhere + " and VentMete like '%" + VentMete + "%'";
            }
            string strOrder = " ContentID  desc";
            return this.dal.GetList(tblName, PageSize, PageIndex, strWhere, strOrder, fldName).Tables[0];
        }

        public DataTable GetListHouse(string tblName, string fldName, int PageSize, int PageIndex, string Title, string HouseProvince, string HouseCity, string HouseArea, string PriceMax, string PriceSmall, string StartTime, string EndTime, int UserNum)
        {
            string strWhere = " UserNum= " + UserNum;
            if (Title != "")
            {
                strWhere = strWhere + " and Title like '%" + Title + "%'";
            }
            if (HouseArea != "")
            {
                strWhere = strWhere + " and HouseArea = '" + HouseArea + "'";
            }
            else if (HouseCity != "")
            {
                strWhere = strWhere + " and HouseCity = '" + HouseCity + "'";
            }
            else if (HouseProvince != "")
            {
                strWhere = strWhere + " and HouseProvince = '" + HouseProvince + "'";
            }
            if ((PriceMax != "") & Utils.IsNumber(PriceMax))
            {
                strWhere = strWhere + " and Price <= " + PriceMax;
            }
            if ((PriceSmall != "") & Utils.IsNumber(PriceSmall))
            {
                strWhere = strWhere + " and Price >= " + PriceSmall;
            }
            if ((StartTime != "") & Utils.IsDateTime(StartTime))
            {
                strWhere = strWhere + " and CreateDate >='" + Utils.SqlStringFormat(StartTime) + "'";
            }
            if ((EndTime != "") & Utils.IsDateTime(EndTime))
            {
                strWhere = strWhere + " and CreateDate <='" + Utils.SqlStringFormat(EndTime) + "'";
            }
            string strOrder = " IsOnTop desc,CreateDate desc";
            return this.dal.GetList(tblName, PageSize, PageIndex, strWhere, strOrder, fldName).Tables[0];
        }

        public DataTable GetListJob(string tblName, int PageSize, int PageIndex, int SellerID)
        {
            string strWhere = " 1=1 AND SellerID = " + SellerID;
            string strOrder = " IssuseDate DESC";
            return this.dal.GetList(tblName, PageSize, PageIndex, strWhere, strOrder).Tables[0];
        }

        public DataTable GetListJob(string tblName, int PageSize, int PageIndex, int SellerID, string strAddress)
        {
            string strWhere = "";
            if ((strAddress == "") || (strAddress == "工作地点"))
            {
                strWhere = strWhere + " 1=1 AND SellerID = " + SellerID;
            }
            else
            {
                object obj2 = strWhere;
                strWhere = string.Concat(new object[] { obj2, " 1=1 AND SellerID = ", SellerID, " AND Address='", strAddress, "'" });
            }
            string strOrder = " ContentID DESC";
            return this.dal.GetList(tblName, PageSize, PageIndex, strWhere, strOrder).Tables[0];
        }

        public DataTable GetListJob(string tblName, int PageSize, int PageIndex, string strCompName, string strJobName, string strSite, string strDegree, string strWorkYear, string strWorkType, string strSalary, string dtIssue, string fldName)
        {
            string strWhere = " 1=1 ";
            if (strCompName != "")
            {
                strWhere = strWhere + " AND SellerName like '%" + strCompName + "%'";
            }
            if (strJobName != "")
            {
                strWhere = strWhere + " AND Name like '%" + strJobName + "%'";
            }
            if (strSite != "")
            {
                strWhere = strWhere + " AND Address like '%" + strSite + "%'";
            }
            if (strDegree != "")
            {
                strWhere = strWhere + " AND Degree like '%" + strDegree + "%'";
            }
            if (strWorkYear != "")
            {
                strWhere = strWhere + " AND WorkYear like '%" + strWorkYear + "%'";
            }
            if (strWorkType != "")
            {
                strWhere = strWhere + " AND WorkType like '%" + strWorkType + "%'";
            }
            if (strSalary != "")
            {
                strWhere = strWhere + " AND Salary like '%" + strSalary + "%'";
            }
            if (dtIssue != "")
            {
                strWhere = strWhere + " AND IssuseDate >= '" + DateTime.Parse(dtIssue).ToShortDateString() + "'";
            }
            string strOrder = " ContentID DESC";
            return this.dal.GetList(tblName, PageSize, PageIndex, strWhere, strOrder, fldName).Tables[0];
        }

        public DataTable GetListJob(string tblName, int PageSize, int PageIndex, string strAll, string strCompName, string strJobName, string strSite, string strDegree, string strWorkYear, string strWorkType, string strSalary, string dtIssue, string vocation, string fldName)
        {
            int num;
            int num2;
            string str3;
            string strWhere = " 1=1 ";
            if (strAll != "")
            {
                str3 = strWhere;
                strWhere = str3 + " AND SellerName like '%" + strAll + "%' OR Name like '%" + strAll + "%'";
            }
            if (strCompName != "")
            {
                strWhere = strWhere + " AND SellerName like '%" + strCompName + "%'";
            }
            if (strJobName != "")
            {
                string[] strArray = strJobName.Split(new char[] { ',' });
                string[] strArray2 = new string[strArray.Length];
                for (num = 0; num < strArray.Length; num++)
                {
                    if (strArray[num] != "")
                    {
                        strArray2[num] = strArray[num];
                    }
                }
                strWhere = strWhere + " AND Name like '%" + strArray2[0] + "%'";
                for (num2 = 1; num2 < strArray2.Length; num2++)
                {
                    if ((strArray2[num2] != null) && (strArray2[num2] != ""))
                    {
                        strWhere = strWhere + " OR Name like '%" + strArray2[num2] + "%'";
                    }
                }
            }
            if (strSite != "")
            {
                string[] strArray3 = strSite.Split(new char[] { ',' });
                string[] strArray4 = new string[strArray3.Length];
                for (num = 0; num < strArray3.Length; num++)
                {
                    if (strArray3[num] != "")
                    {
                        strArray4[num] = strArray3[num];
                    }
                }
                str3 = strWhere;
                strWhere = str3 + " AND (Address like '%" + strArray4[0] + "%' OR Province like '%" + strArray4[0] + "%')";
                for (num2 = 1; num2 < strArray4.Length; num2++)
                {
                    if ((strArray4[num2] != null) && (strArray4[num2] != ""))
                    {
                        str3 = strWhere;
                        strWhere = str3 + " OR (Address like '%" + strArray4[num2] + "%' OR Province like '%" + strArray4[0] + "%')";
                    }
                }
            }
            if (strDegree != "")
            {
                strWhere = strWhere + " AND Degree like '%" + strDegree + "%'";
            }
            if (strWorkYear != "")
            {
                strWhere = strWhere + " AND WorkYear like '%" + strWorkYear + "%'";
            }
            if (strWorkType != "")
            {
                strWhere = strWhere + " AND WorkType like '%" + strWorkType + "%'";
            }
            if (strSalary != "")
            {
                strWhere = strWhere + " AND Salary like '%" + strSalary + "%'";
            }
            if (dtIssue != "")
            {
                strWhere = strWhere + " AND IssuseDate >= '" + DateTime.Parse(dtIssue).ToShortDateString() + "'";
            }
            if (vocation != "")
            {
                string[] strArray5 = vocation.Split(new char[] { ',' });
                string[] strArray6 = new string[strArray5.Length];
                for (num = 0; num < strArray5.Length; num++)
                {
                    if (strArray5[num] != "")
                    {
                        strArray6[num] = strArray5[num];
                    }
                }
                strWhere = strWhere + " AND Vocation like '%" + strArray6[0] + "%'";
                for (num2 = 1; num2 < strArray6.Length; num2++)
                {
                    if ((strArray6[num2] != null) && (strArray6[num2] != ""))
                    {
                        strWhere = strWhere + " OR Vocation like '%" + strArray6[num2] + "%'";
                    }
                }
            }
            string strOrder = " ContentID DESC";
            return this.dal.GetList(tblName, PageSize, PageIndex, strWhere, strOrder, fldName).Tables[0];
        }

        public DataTable GetListSell(string tblName, string fldName, int PageSize, int PageIndex, string Title, string CarProvince, string CarCity, string CarArea, string PriceMax, string PriceSmall, string StartTime, string EndTime, int UserNum)
        {
            string strWhere = " UserNum= " + UserNum;
            if (Title != "")
            {
                strWhere = strWhere + " and Title like '%" + Title + "%'";
            }
            if (CarArea != "")
            {
                strWhere = strWhere + " and CarArea = '" + CarArea + "'";
            }
            else if (CarCity != "")
            {
                strWhere = strWhere + " and CarCity = '" + CarCity + "'";
            }
            else if (CarProvince != "")
            {
                strWhere = strWhere + " and CarProvince = '" + CarProvince + "'";
            }
            if ((PriceMax != "") & Utils.IsNumber(PriceMax))
            {
                strWhere = strWhere + " and Price <= " + PriceMax;
            }
            if ((PriceSmall != "") & Utils.IsNumber(PriceSmall))
            {
                strWhere = strWhere + " and Price >= " + PriceSmall;
            }
            if ((StartTime != "") & Utils.IsDateTime(StartTime))
            {
                strWhere = strWhere + " and CreateDate >='" + Utils.SqlStringFormat(StartTime) + "'";
            }
            if ((EndTime != "") & Utils.IsDateTime(EndTime))
            {
                strWhere = strWhere + " and CreateDate <='" + Utils.SqlStringFormat(EndTime) + "'";
            }
            string strOrder = " IsOnTop desc,CreateDate desc";
            return this.dal.GetList(tblName, PageSize, PageIndex, strWhere, strOrder, fldName).Tables[0];
        }

        public DataTable GetModel(string tblName, int ContentID)
        {
            string strWhere = " ContentID=" + ContentID;
            return this.dal.GetModel(tblName, strWhere).Tables[0];
        }

        public DataTable GetModel(string tblName, string strWhere)
        {
            return this.dal.GetModel(tblName, strWhere).Tables[0];
        }

        public DataTable GetModel(string tblName, int ContentID, int UserNum)
        {
            string strWhere = string.Concat(new object[] { " UserNum= ", UserNum, " and ContentID=", ContentID });
            return this.dal.GetModel(tblName, strWhere).Tables[0];
        }

        public void SearchData_ADD(string Contentid, string State, string Title, string Keyword)
        {
            KeRui.BLL.Common.ExecuteSQL("EXEC dbo.SearchData_ADD " + Contentid + "," + State + ",N'" + Title + "',N'" + Keyword + "'");
        }

        public DataSet SearchListByCache(string tblName, string strWhere, int PageSize, int PageIndex)
        {
            string cacheKey = string.Concat(new object[] { tblName, "-", strWhere, "-", PageSize, "-", PageIndex });
            object cache = DataCache.GetCache(cacheKey);
            if (cache == null)
            {
                try
                {
                    cache = this.dal.GetList(tblName, PageSize, PageIndex, strWhere, " CreateDate Desc", "*");
                    if (cache != null)
                    {
                        int configInt = ConfigHelper.GetConfigInt("DataCache");
                        DataCache.SetCache(cacheKey, cache, DateTime.Now.AddMinutes((double) configInt), TimeSpan.Zero);
                    }
                }
                catch
                {
                }
            }
            return (DataSet) cache;
        }

        public DataSet SearchListByCache(string tblName, string strWhere, int PageSize, int PageIndex, string strOrder)
        {
            string cacheKey = string.Concat(new object[] { tblName, "-", strWhere, "-", PageSize, "-", PageIndex });
            object cache = DataCache.GetCache(cacheKey);
            if (cache == null)
            {
                try
                {
                    cache = this.dal.GetList(tblName, PageSize, PageIndex, strWhere, strOrder, "*");
                    if (cache != null)
                    {
                        int configInt = ConfigHelper.GetConfigInt("DataCache");
                        DataCache.SetCache(cacheKey, cache, DateTime.Now.AddMinutes((double) configInt), TimeSpan.Zero);
                    }
                }
                catch
                {
                }
            }
            return (DataSet) cache;
        }

        public void Update(string tblName, string Keyword, string ContentID)
        {
            KeRui.BLL.Common.ExecuteSQL("UPDATE " + tblName + " SET Keyword='" + Keyword + "' WHERE ContentID=" + ContentID);
        }
    }
}

